package com.crm.business.admin.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.crm.business.crm.service.BillCrmOrderPoolService;
import com.crm.business.crm.service.IBillCrmStudentPoolService;
import com.crm.common.crm.entity.BO.BillOrderPoolBO;
import com.crm.common.crm.entity.BO.BillStudentPoolBO;
import com.crm.common.crm.entity.PO.BillCrmOrderPool;
import com.crm.common.crm.entity.PO.BillCrmStudentPool;
import com.crm.common.ka.core.common.R;
import com.crm.common.ka.core.common.Result;
import com.crm.common.ka.core.common.log.BehaviorEnum;
import com.crm.common.ka.core.common.log.SysLogHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/adminStudentPool")
@Api(tags = "VIP学员库")
@Slf4j
public class BillAdminStudentPoolController {

    @Autowired
    private IBillCrmStudentPoolService billCrmStudentPoolService;

    @PostMapping("/queryPageList")
    @ApiOperation("查询列表页数据")
    public Result<IPage<BillCrmStudentPool>> queryPageList(@RequestBody BillStudentPoolBO billCrmStudentPool) {
        IPage<BillCrmStudentPool> poolPage = billCrmStudentPoolService.queryPageList(billCrmStudentPool);
        return R.ok(poolPage);
    }

    @GetMapping("/queryById/{id}")
    @ApiOperation("查询详细")
    public Result<BillCrmStudentPool> queryById(@PathVariable("id") Integer id){
        return  billCrmStudentPoolService.queryById(id);
    }


    @PostMapping("/update")
    @ApiOperation("更新数据")
    @SysLogHandler(behavior = BehaviorEnum.UPDATE)
    public Result<Map<String, Object>> update(@RequestBody BillCrmStudentPool billCrmStudentPool){
        return  billCrmStudentPoolService.update(billCrmStudentPool);
    }


}
